﻿<%@ Page Language="C#" MasterPageFile="~/design/Admin.Master" AutoEventWireup="true"
    CodeFile="Vystavy.aspx.cs" Inherits="Zadani09.admin.Vystavy" Title="Správa výstav" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="LoginPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MenuPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentVrchniPlaceholder" runat="server">
    <h2 style="margin-bottom: 2px">Seznam výstav pro admina</h2>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
        <ContentTemplate>
            <asp:TextBox ID="TextBox1" runat="server">
            </asp:TextBox>
            <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
                DelimiterCharacters="" Enabled="True" ServicePath="" TargetControlID="TextBox1" 
                UseContextKey="True" ServiceMethod="GetCompletionList" 
                MinimumPrefixLength="1">
            </cc1:AutoCompleteExtender>
            &nbsp;
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                <asp:ListItem Value="id_vystava" Text="ID výstavy"></asp:ListItem>
                <asp:ListItem Value="jmeno" Text="Jméno"></asp:ListItem>
                <asp:ListItem Value="popis" Text="Popis"></asp:ListItem>
                <asp:ListItem Value="dlouhy_popis" Text="Dlouhý popis"></asp:ListItem>
                <asp:ListItem Value="vernisaz" Text="Vernisáž"></asp:ListItem>
                <asp:ListItem Value="zacatek" Text="Začátek"></asp:ListItem>
                <asp:ListItem Value="konec" Text="Konec"></asp:ListItem>
                <asp:ListItem Value="oteviraci_doba" Text="Otevírací doba"></asp:ListItem>
                <asp:ListItem Value="cena_vstupenky_dospeli" Text="Cena vstupenky dospělí"></asp:ListItem>
                <asp:ListItem Value="cena_vstupenky_deti" Text="Cena vstupenky děti"></asp:ListItem>
            </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>
    &nbsp;
    <asp:Button ID="Button1" runat="server" Text="Vyhledat" Font-Size="12px" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" Width="740px"
        AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"
        DataKeyNames="IDVystava" CssClass="mar_top_3" onselectedindexchanged="GridView1_SelectedIndexChanged">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:CommandField SelectText="Detail" ShowSelectButton="True" 
                DeleteText="Smazat" ShowDeleteButton="True">
                <ItemStyle Font-Bold="True" />
            </asp:CommandField>
            <asp:BoundField DataField="IDVystava" HeaderText="ID" SortExpression="IDVystava" />
            <asp:BoundField DataField="IDGalerie" HeaderText="ID galerie" SortExpression="IDGalerie" />
            <asp:BoundField DataField="Jmeno" HeaderText="Jméno" SortExpression="Jmeno" />
            <asp:BoundField DataField="Zacatek" HeaderText="Začátek" SortExpression="Zacatek" />
            <asp:BoundField DataField="Konec" HeaderText="Konec" SortExpression="Konec" Visible="False" />
            <asp:BoundField DataField="OteviraciDoba" HeaderText="Otevírací doba" SortExpression="OteviraciDoba" />
            <asp:BoundField DataField="CenaVstupenkyDeti" HeaderText="Cena děti" SortExpression="CenaVstupenkyDeti" />
            <asp:BoundField DataField="CenaVstupenkyDospeli" HeaderText="Cena dospělí" SortExpression="CenaVstupenkyDospeli" />
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý Popis" SortExpression="DlouhyPopis"
                Visible="False" />
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis" Visible="False" />
            <asp:TemplateField HeaderText="Stav" SortExpression="Stav">
                <ItemTemplate>
                    <asp:Label ID="LabelStav" runat="server" Text='<%# (Eval("Stav").ToString() == "1" ? "naplánována" : "plánována") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Vernisaz" HeaderText="Vernisaz" SortExpression="Vernisaz"
                Visible="False" />
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <h2 style="margin-bottom: 2px">
        Přidání a editace výstavy</h2>
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="417px" AutoGenerateRows="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2"
        ForeColor="Black" GridLines="None" DataSourceID="ObjectDataSource2" DataKeyNames="IDVystava">
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="IDVystava" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                SortExpression="IDVystava">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="ID galerie" SortExpression="IDGalerie">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="20px" Width="150px" DataSourceID="ObjectDataSource3"
                        DataTextField="Jmeno" DataValueField="IDGalerie" SelectedValue='<%# Bind("IDGalerie") %>'>
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" Height="20px" SelectedValue='<%# Bind("IDGalerie") %>'
                        Width="150px" DataSourceID="ObjectDataSource3" DataTextField="Jmeno" DataValueField="IDGalerie">
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("IDGalerie") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" Font-Italic="False" />
            </asp:TemplateField>
            <asp:BoundField DataField="Jmeno" HeaderText="Jméno" SortExpression="Jmeno">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Vernisaz" HeaderText="Vernisáž" SortExpression="Vernisaz">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Zacatek" HeaderText="Začátek" SortExpression="Zacatek">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Konec" HeaderText="Konec" SortExpression="Konec">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="CenaVstupenkyDeti" HeaderText="Cena vstupenky pro děti"
                SortExpression="CenaVstupenkyDeti">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="CenaVstupenkyDospeli" HeaderText="Cena vstupenky pro dospělé"
                SortExpression="CenaVstupenkyDospeli">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý popis" SortExpression="DlouhyPopis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="OteviraciDoba" HeaderText="Otevírací Doba" SortExpression="OteviraciDoba">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Stav" SortExpression="Stav">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList3" runat="server" Height="20px" SelectedValue='<%# Bind("Stav") %>'
                        Width="150px">
                        <asp:ListItem Value="0">Plánována</asp:ListItem>
                        <asp:ListItem Value="1">Naplánována</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList4" runat="server" Height="20px" SelectedValue='<%# Bind("Stav") %>'
                        Width="150px">
                        <asp:ListItem Value="0">Plánována</asp:ListItem>
                        <asp:ListItem Value="1">Naplánována</asp:ListItem>
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# (Eval("Stav").ToString() == "1" ? "naplánována" : "plánována") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" />
            </asp:TemplateField>
            <asp:CommandField InsertText="Vložit" NewText="Vložit novou výstavu" ShowEditButton="True"
                ShowInsertButton="True" UpdateText="Aktualizuj">
                <ItemStyle Font-Bold="True" ForeColor="Red" />
            </asp:CommandField>
        </Fields>
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:DetailsView>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="Zadani09.db.Vystava"
        OldValuesParameterFormatString="original_{0}" SelectMethod="ctiJednu" TypeName="Zadani09.db.ODS.VystavaDataObject"
        UpdateMethod="aktualizuj" InsertMethod="vloz">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="1" Name="id" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Zadani09.db.Vystava"
        DeleteMethod="smaz" OldValuesParameterFormatString="original_{0}" SelectMethod="cti_s_vyhledavanim"
        TypeName="Zadani09.db.ODS.VystavaDataObject">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
            <asp:ControlParameter ControlID="TextBox1" DefaultValue="" Name="hledano" PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="id_umelec" Name="atribut" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="cti" TypeName="Zadani09.db.ODS.GalerieDataObject">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <h2 style="margin-bottom: 2px">
        Díla na výstavě</h2>
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2"
        DataSourceID="ObjectDataSource4" ForeColor="Black" GridLines="None">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:BoundField DataField="IDDilo" HeaderText="IDDilo" SortExpression="IDDilo" />
            <asp:BoundField DataField="Nazev" HeaderText="Nazev" SortExpression="Nazev" />
            <asp:BoundField DataField="Datum" HeaderText="Datum" SortExpression="Datum" />
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice" />
            <asp:BoundField DataField="Popisne" HeaderText="Č.p." SortExpression="Popisne" />
            <asp:BoundField DataField="Mesto" HeaderText="Mesto" SortExpression="Mesto" />
            <asp:BoundField DataField="PSC" HeaderText="PSC" SortExpression="PSC" />
            <asp:TemplateField HeaderText="NaProdej" SortExpression="NaProdej">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# (Eval("NaProdej").ToString() == "1" ? "ano" : "ne") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="DlouhyPopis" HeaderText="DlouhyPopis" SortExpression="DlouhyPopis"
                Visible="False" />
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis" Visible="False" />
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="dila_na_vystave" 
        TypeName="Zadani09.db.ODS.VystavaDiloDataObject">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="vystava" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:Panel ID="Panel1" runat="server">
    <h2 style="margin-bottom: 2px">
        Přidání díla na výstavu</h2>
    </asp:Panel>
    <asp:DropDownList ID="DropDownList5" runat="server" 
        DataSourceID="ObjectDataSource5" DataTextField="Nazev" 
        DataValueField="IDDilo" Height="20px" Width="150px">
    </asp:DropDownList>
    &nbsp;<asp:Button ID="Button2" runat="server" Text="přidat" 
        onclick="Button2_Click" />
    <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" 
        InsertMethod="prirad_dilo_vystave" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="dila_ne_na_vystave" 
        TypeName="Zadani09.db.ODS.VystavaDiloDataObject">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="vystava" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
<%--            <asp:Parameter Name="vystava" Type="Int32" />
            <asp:Parameter Name="dilo" Type="Int32" />
--%>        <asp:ControlParameter Name="vystava" ControlID="GridView1" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter Name="dilo" ControlID="DropDownList5" PropertyName="SelectedValue" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>
    </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentSpodniPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BottomPlaceholder" runat="server">
</asp:Content>
